//
//  CircleDetailReturnTableViewCell.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/3.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "CircleDetailReturnTableViewCell.h"

@implementation CircleDetailReturnTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        
        GLGWImageView *imagV = [[GLGWImageView alloc] initInSuperView:self.contentView];
        [imagV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@(kWidthProportion_In_iPhoneTriploid(16)));
            make.top.equalTo(@(kHeightProportion_In_iPhoneTriploid(18)));
            make.width.height.equalTo(@(kWidthProportion_In_iPhoneTriploid(44)));
        }];
        imagV.backgroundColor = kRandomColor;
        imagV.layer.masksToBounds = YES;
        imagV.layer.cornerRadius = 22;
        
        GLGWLabel *label = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#A89A60"] inSuperView:self.contentView];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(@(kHeightProportion_In_iPhoneTriploid(15)));
            make.left.equalTo(imagV.mas_right).offset(kWidthProportion_In_iPhoneTriploid(10));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(140));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        label.text = @"陈也";
//
        GLGWLabel *label2 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:self.contentView];
        [label2 mas_updateConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(label.mas_left);
            make.top.equalTo(label.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
            make.right.equalTo(@(-kWidthProportion_In_iPhoneTriploid(15)));
            make.bottom.equalTo(@(-kHeightProportion_In_iPhoneTriploid(50)));

        }];
        label2.text = @"为什么要卖啊么要卖啊么要卖啊么要卖啊么要卖啊么要卖啊么要卖啊么要卖啊么要卖啊么要卖啊？";
        label2.numberOfLines = 0;
        
        GLGWButton *replyBtn = [[GLGWButton alloc] initWithTitle:@"回复" titleLableFont:SYSTEMFONT(13) titleLableColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self.contentView];
        [replyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(label2.mas_left);
            make.top.equalTo(label2.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(46)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(25)));
        }];
        [replyBtn setBackgroundColor:[UIColor colorWithHexString:@"#EAEAEA"]];
        replyBtn.layer.masksToBounds = YES;
        replyBtn.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(25) /2;
        [replyBtn addTarget:self action:@selector(replyAction:) forControlEvents:UIControlEventTouchUpInside];

        GLGWButton *likeBtn = [[GLGWButton alloc] initWithTitle:@"20" titleLableFont:SYSTEMFONT(14) titleLableColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self.contentView];
        [likeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(10));
            make.centerY.equalTo(replyBtn.mas_centerY);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(60)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(25)));
        }];
        [likeBtn setImagePositionWithType:SSImagePositionTypeLeft spacing:4];
        [likeBtn setImage:[UIImage imageNamed:@"goods_shoucan"] forState:UIControlStateNormal];
        [likeBtn addTarget:self action:@selector(likeAction:) forControlEvents:UIControlEventTouchUpInside];
        
        GLGWLabel *label3 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self.contentView];
        [label3 mas_updateConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.centerY.equalTo(label.mas_centerY);
            make.width.equalTo(@(110));
            make.height.equalTo(@(17));
        }];
        label3.text = @"2018-09-25 12:00";
        
        [self setSepartionLineWith:lineModel_Half];
    }
    return self;
}

- (void)replyAction:(GLGWButton *)sender
{
    if (self.BlockReply) {
        self.BlockReply(sender);
    }
}

- (void)likeAction:(GLGWButton *)sender
{
    if (self.BlockLike) {
        self.BlockLike(sender);
    }
}

@end
